import java.util.*;

public class Solution {
    public int duplicate (int[] numbers) {
        int[] newArray = new int[numbers.length];
        int i;
        for (i = 0; i < numbers.length; i++) {
            //例如：原数组0位置下标的元素是2，在新数组2下标位置加1
            newArray[numbers[i]]++;
            if (newArray[numbers[i]]>1){
                return numbers[i];
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] numbers = {};
        int a = solution.duplicate(numbers);
        System.out.println(a);
    }
}